<template>
  <div>
    <h3>child组件</h3>
    <hr />
    <ul>
      <li v-for="(item, index) in users" :key="item.id">
        <span>
          {{ item.name }}
        </span>
        <span>
          <!-- 让插槽传数据 作用域插槽 -->
          <slot name="del" :index="index">
            <span @click="del(index)">删除</span>
          </slot>
        </span>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: ['users'],
  data() {
    return {}
  },
  methods: {
    del(index) {
      console.log(index)
    }
  }
}
</script>

<style lang="scss" scoped></style>
